package demo3;

public class Student {
	private int number; // 学号
	private String name; // 姓名
	private Room[] laboratory; // 实验室

	public Student() {
	}

	// 带参构造
	public Student(int number, String name) {
		this.number = number;
		this.name = name;
	}

	// 计算补助金额，分为四个等级，ABCD对应优良中差
	public double getMoneyEarned() {
		double moneyEarned = 0;
		for (Room room : laboratory) {
			for (String cleanlinessScore : room.getCleanlinessScore()) {
				switch (cleanlinessScore) {
				case "A":
					moneyEarned += 1500;
					break;
				case "B":
					moneyEarned += 800;
					break;
				case "C":
					moneyEarned += 500;
					break;
				case "D":
					moneyEarned += 100;
					break;
				}
			}
		}
		return moneyEarned;
	}

	// 根据税收计算实际收入
	public double getActualIncome() {
		return getMoneyEarned() - Tax.getTax(getMoneyEarned());
	}

	// 输出某学生和他的实验室清洁记录
	public void print() {
		System.out.println(this); // 相当于System.out.println(this.toString());
		for (Room room : laboratory) {
			System.out.println(room.toString());
		}
	}

	// 以下是一堆get和set方法
	public int getNumber() {
		return number;
	}

	public void setNumber(int number) {
		this.number = number;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public Room[] getLaboratory() {
		return laboratory;
	}

	public void setLaboratory(Room[] laboratory) {
		this.laboratory = laboratory;
	}

	// toString输出学生信息
	@Override
	public String toString() {
		return "\n"+"学号：" + number +"\n"+ "姓名：" + name+"\n" + "奖学金：" + getMoneyEarned() +"\n"+ "实际收入：" + getActualIncome();
	}
}
